package me.ratel.demo.wechat;

import com.alibaba.fastjson.JSONObject;
import me.ratel.demo.wechat.config.Configuration;
import me.ratel.demo.wechat.config.ConfigurationImpl;
import me.ratel.demo.wechat.entities.BrandWCPayRequest;
import me.ratel.demo.wechat.entities.GetMenuResponse;
import me.ratel.demo.wechat.entities.OAuth2UserInfo;
import me.ratel.demo.wechat.entities.OrderQueryResponse;
import me.ratel.demo.wechat.entities.SnsOAuth2AccessTokenResponse;
import me.ratel.demo.wechat.entities.UnifiedOrderResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Administrator
 * @time 2016/8/28 13:18
 */
abstract class AbstractWeChatService implements WeChatService {
    private static final Logger log = LoggerFactory.getLogger(AbstractWeChatService.class);

    protected WeChatService delegate;

    protected Configuration configuration;

    public AbstractWeChatService(WeChatService delegate) {
        this.delegate = delegate;
        this.configuration = ConfigurationImpl.getConfiguration();
    }

    @Override public GetMenuResponse getMenu() {
        return delegate.getMenu();
    }

    @Override public UnifiedOrderResponse unifiedOrder(String body, JSONObject detail, String notifyURL, String outTradeNo, String openId, String spbillCreateIP, int totalFee, String tradeType) {
        return delegate.unifiedOrder(body, detail, notifyURL, outTradeNo, openId, spbillCreateIP, totalFee, tradeType);
    }

    @Override public BrandWCPayRequest getBrandWCPayRequest(String prepayId) {
        return delegate.getBrandWCPayRequest(prepayId);
    }

    @Override public OrderQueryResponse orderQuery(String outTradeNo) {
        return delegate.orderQuery(outTradeNo);
    }

    @Override public String createOauth2AuthorizeURL(String redirectUri) {
        return delegate.createOauth2AuthorizeURL(redirectUri);
    }

    @Override public SnsOAuth2AccessTokenResponse snsOAuth2AccessToken(String code) {
        return delegate.snsOAuth2AccessToken(code);
    }

    @Override public SnsOAuth2AccessTokenResponse refreshOAuth2AccessToken(String refreshToken) {
        return delegate.refreshOAuth2AccessToken(refreshToken);
    }

    @Override public OAuth2UserInfo snsUserInfo(String accessToken, String openId) {
        return delegate.snsUserInfo(accessToken, openId);
    }
}
